home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / boot / vbrmov23.lha / VBRMove.asm < prev    next >
Assembly Source File  |  1994-04-24  |  3KB  |  166 lines

  1.     nolist
  2. ;:ts=8
  3. *****************************************************************
  4. *                                                               *
  5. * VBRMove version 2.3, © 1991 Arthur Hagen, All rights reserved *
  6. *                                                               *
  7. * Posted to the Public Domain.                                  *
  8. *                                                               *
  9. * Written using the Aztec Manx C 5.0 Assembler                  *
  10. *                                                               *
  11. * All comments deliberately stripped from source.               *
  12. * If you don't understand it, you should not mess with it!      *
  13. *                                                               *
  14. *****************************************************************
  15.  
  16.     include    'exec/memory.i'
  17.     include    'exec/execbase.i'
  18.     xref    _LVOOldOpenLibrary
  19.     xref    _LVOCloseLibrary
  20.     xref    _LVOSuperState
  21.     xref    _LVOCopyMemQuick
  22.     xref    _LVOOutput
  23.     xref    _LVOWrite
  24.     xref    _LVOAllocMem
  25.     xref    _LVOFreeMem
  26.     xref    _LVOPermit
  27. INTENA    equ    $dff09a
  28.     list
  29.  
  30.     machine    mc68010
  31.     public    _VBRMove
  32. _VBRMove:
  33.     movea.l    (4).w,a6
  34.     lea    INTENA,a3
  35.     moveq    #64,d6
  36.     rol.w    #4,d6
  37.     lea    dosname(pc),a1
  38.     jsr    _LVOOldOpenLibrary(a6)
  39.     movea.l    d0,a5
  40.     exg.l    a5,a6
  41.     jsr    _LVOOutput(a6)
  42.     exg.l    a5,a6
  43.     move.l    d0,d7
  44.     moveq    #title_end-title,d3
  45.     lea    title(pc),a0
  46.     bsr    wrt
  47.     btst    #AFB_68010,AttnFlags+1(a6)
  48.     bne.s    tryit
  49.  
  50. badCPU    moveq    #wrongpro_end-wrongpro,d3
  51.     lea    wrongpro(pc),a0
  52.     bra.s    writerr
  53.  
  54. tryit    jsr    _LVOSuperState(a6)
  55.     movec    VBR,d4
  56.     move.l    sp,USP
  57.     movea.l    d0,sp
  58.     andi.w    #$dfff,SR
  59.     tst.l    d4
  60.     bne.s    alrdy
  61.  
  62.     lea    MemList+LH_HEAD(a6),a0
  63.     moveq    #0,d2
  64.     moveq    #$3f,d3
  65.     not.b    d3
  66.     moveq    #0,d5
  67.     not.b    d5
  68.  
  69. loopit1    movea.l    LN_SUCC(a0),a0
  70.     tst.l    LN_SUCC(a0)
  71.     beq.s    memdon1
  72.  
  73.     move.w    MH_LOWER(a0),d0
  74.  
  75.     cmp.w    d3,d0
  76.     bcc.s    loopit1
  77.     cmp.w    d5,d0
  78.     bcs.s    loopit1
  79.  
  80.     lea    MH_FIRST(a0),a4
  81.     lea    MH_FREE(a0),a2
  82.     move.w    #$4000,(a3)
  83.     addq.b    #1,IDNestCnt(a6)
  84.     move.l    (a4),d2
  85.     move.l    (a2),d3
  86.     moveq    #0,d0
  87.     move.l    d0,(a4)
  88.     move.l    d0,(a2)
  89.  
  90. memdon1    move.l    d6,d0
  91.     addq.l    #8,d0
  92.     moveq    #MEMF_FAST|MEMF_PUBLIC,d1
  93.     jsr    _LVOAllocMem(a6)
  94.     tst.l    d2
  95.     beq.s    memdon2
  96.  
  97.     move.l    d2,(a4)
  98.     move.l    d3,(a2)
  99.     subq.b    #1,IDNestCnt(a6)
  100.     bge.s    memdon2
  101.     move.w    #$c000,(a3)
  102.  
  103. memdon2    move.l    d0,d4
  104.     beq.s    nofm
  105.  
  106.     andi.w    #$fff0,d4
  107.     suba.l    a0,a0
  108.     movea.l    d4,a1
  109.     bsr.s    copy1k
  110.     move.l    d4,d3
  111.     bsr.s    setvbr
  112.  
  113. quit    movea.l    a5,a1
  114.     jmp    _LVOCloseLibrary(a6)
  115.  
  116. nofm    moveq    #nofastmem_end-nofastmem,d3
  117.     lea    nofastmem(pc),a0
  118.  
  119. writerr    pea    quit(pc)
  120.  
  121. wrt    move.l    a0,d2
  122.     move.l    d7,d1
  123.     exg.l    a5,a6
  124.     jsr    _LVOWrite(a6)
  125.     exg.l    a5,a6
  126.     rts
  127.  
  128. alrdy    moveq    #already_end-already,d3
  129.     lea    already(pc),a0
  130.     bsr.s    wrt
  131.     move.l    d4,a0
  132.     suba.l    a1,a1
  133.     bsr.s    copy1k
  134.     moveq    #0,d3
  135.     bsr.s    setvbr
  136.     move.l    d4,a1
  137.     move.l    d6,d0
  138.     jsr    _LVOFreeMem(a6)
  139.     bra.s    quit
  140.  
  141. copy1k    move.l    d6,d0
  142.     jmp    _LVOCopyMemQuick(a6)
  143.  
  144. setvbr    jsr    _LVOSuperState(a6)
  145.     movec    d3,VBR
  146.     move.l    sp,USP
  147.     movea.l    d0,sp
  148.     andi.w    #$dfff,SR
  149.     rts
  150.  
  151.     dc.b    '$VER: '
  152. title    dc.b    'VBRMove 2.3 (24.4.94)',$0A,$0D
  153.     dc.b    'Copyright ',$A9,' 1992 Arthur Hagen.',$0A
  154. title_end
  155. already    dc.b    'Clearing VBR.',$0A
  156. already_end
  157. wrongpro
  158.     dc.b    'You need 68010 or higher!',$0A
  159. wrongpro_end
  160. nofastmem
  161.     dc.b    "No fast memory!",$0A
  162. nofastmem_end
  163. dosname    dc.b    'dos.library',0
  164.     even
  165.     END
  166.